package com.String;

import java.util.Objects;
import java.util.Scanner;

public class Accout {
    public static void main(String[] args) {
        String accout = "banyuan";
        String password = "123";
        for (int i = 0; i < 3; i++) {
            Scanner sc = new Scanner(System.in);
            System.out.println("输入密码");
            String next = sc.next();
            if (Objects.equals(password,next)) {
                System.out.println("登录成功");
                break;
            }
            if (i < 2) {
                System.out.println("密码错误，还剩下" + (2 - i) + "机会");
            }else {
                System.out.println("账号已锁定");
            }

        }
    }
}
